projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c4daff9
)
Avoid undefined behaviour when copying part of structure
author
Andreas Schwab
<schwab@linux-m68k.org>
Mon, 29 Nov 2021 09:29:40 +0000
(10:29 +0100)
committer
Eli Zaretskii
<eliz@gnu.org>
Mon, 29 Nov 2021 12:45:40 +0000
(14:45 +0200)
* src/dispnew.c (copy_row_except_pointers): Don't use address of
subobject as starting point.
(cherry picked from commit
6943786b5c1fe76ea05a3a810512bd6777883710
)
src/dispnew.c
patch
|
blob
|
history
diff --git
a/src/dispnew.c
b/src/dispnew.c
index 53eb8984747c58da2376486f4c42432bba7b14e3..4a9f2bae44b9fe452dd6b3d363d5066348ba7474 100644
(file)
--- a/
src/dispnew.c
+++ b/
src/dispnew.c
@@
-1034,7
+1034,7
@@
copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
{
enum { off = offsetof (struct glyph_row, x) };
- memcpy (
&to->x, &from->x
, sizeof *to - off);
+ memcpy (
(char *) to + off, (char *) from + off
, sizeof *to - off);
}